﻿<?php
$masterView = MasterView::getInstance();
foreach ($masterView->streamView->signals as $item) :
    $timestamp = $item->date->format("U");
    ?>
    <li class="mozaic-widget list-item story-signal mozaic-initialized widget-story_signal">
        <div class="mention-container alert-container alert-story-container signal-green">
            <div class="mention-left-content">
                <div class="annotable-extra-container">
                    <div class="mozaic-widget mozaic-initialized widget-signal_annotable_extra">
                        <p class="mention-time-stamp extend signals-time-stamp-3" data-timestamp="<?php echo $timestamp; ?>">
                            <?php
                            echo Utils::humanTiming($item->date->format("U"));
                            ?>
                        </p>

                        <p class="mention-type additional-timestamp" data-timestamp="<?php echo $timestamp; ?>"><?php echo $item->date->format("M d Y h:m A P"); ?></p><!-- end template: templates/annotable/annotable_extra.hjs -->
                    </div>
                </div>

                <div class="mention-circle-holder">
                    <i class="icon-cirlce-background"></i>
                </div>
            </div>

            <div class="mention-right-content">
                <div class="mention-right-wrapper">
                    <div class="mention-right-container extend">
                        <div class="mention-content blog_mention">
                            <div class="mozaic-widget mozaic-initialized widget-signal_top_bar">
                                <div class="mention-top-bar">
                                    <p class="mention-type signal-type"><a class="filter-link filter-link-signal-type" data-filter="type__in" data-original-title="Show all Top Story Signals" data-value="story" rel="tooltip">Top Story</a> <span class="signal-type-span">for</span> <a class="filter-link filter-link-stream" data-filter="keyword_id" data-original-title="Show all Hewlett Packard Signals" data-value="1000005764" rel="tooltip"><i class="icon-stream-company-small"></i> <?php echo $masterView->streamView->model->name; ?><span class="signal-stream-visual"></span></a></p>
                                    <p class="mention-type additional-timestamp signals-additional-time" data-timestamp="<?php echo $timestamp; ?>"><?php echo $item->date->format("M d Y h:m A P"); ?></p>
                                </div>
                            </div>
                            <div class="mention-core">
                                <div class="mention-core-wrapper">
                                    <div class="mention-content-full">
                                        <div class="context-border-container">
                                            <a href="<?php echo $item->message->getURL(); ?>" target="_blank">
                                                <img src="<?php echo $item->image; ?>" style="width: 100px"/>
                                            </a>
                                        </div>
                                        <div class="resource-text-container">
                                            <p class="mention-title"><a class="action-color-hover" href="<?php echo $item->message->getURL(); ?>" target="_blank"><?php echo $item->message->getThreadTitle(); ?></a></p>

                                            <p class="mention-short-url"><a class="action-color-active" href="<?php echo $item->message->getURL(); ?>" target="_blank"><?php $parse = parse_url($item->message->getURL());
                        echo str_ireplace('www.', '', $parse["host"]);
                            ?></a></p>
                                        </div>
                                        <p class="mention-text">
                                            <?php
                                            $text = $item->message->getText();
                                            if (substr_count($text, " ") > 100) {
                                                //find the 100th char(' ')
                                                $endpos = 200;
                                                $endpos = strpos($text, " ", $endpos);
                                                echo Signal::parseLinks(substr($text, 0, $endpos));
                                                ?>
                                                <span class="readmore-threedot">...</span>
                                                <span class="readmore spanshow" onclick="expand(this);" style="color: orange; cursor: pointer;">Read more</span>
                                                <span class="readmore-content hide"><?php echo Signal::parseLinks(substr($text, $endpos)); ?></span>
                                                <?php
                                            }
                                            else
                                                echo Signal::parseLinks($text);
                                            ?>
                                        </p>
                                    </div>
                                </div>
                                <div class="tags-holder-container first-two-tags">
                                    <div class="mozaic-widget mozaic-initialized widget-annotable_tags">
                                        <div class="clear"></div>
                                    </div>
                                </div>
                                <div class="more-tags-holder">
                                    <span>...</span>
                                    <div class="more-tags-tooltip">
                                        <div class="arrow-icon"></div>
                                        <div class="tags-holder-container more-tags-container">
                                            <div class="mozaic-widget mozaic-initialized widget-annotable_tags" data-guid="widget-678" data-params="{&quot;base_id&quot;:&quot;27268099&quot;,&quot;channels&quot;:{&quot;/taggings&quot;:&quot;/taggings-666&quot;,&quot;/tags&quot;:&quot;/tags-3&quot;,&quot;/filters&quot;:&quot;/filters-4&quot;,&quot;/annotables&quot;:&quot;/signals-582&quot;}}" data-widget="annotable_tags">
                                                <div class="clear"></div>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="signal-action-bar-container"><div class="mozaic-widget widget-signal_action_bar" data-widget="signal_action_bar" data-params="{&quot;action&quot;:&quot;Engage&quot;,&quot;context_type&quot;:&quot;company&quot;,&quot;type&quot;:&quot;influencer&quot;,&quot;channels&quot;:{&quot;/annotables&quot;:&quot;/signals-1414&quot;,&quot;/social_profiles&quot;:&quot;/social_profiles-5&quot;,&quot;/streams&quot;:&quot;/streams-2&quot;},&quot;id&quot;:&quot;27852612&quot;,&quot;stream_id&quot;:&quot;1000032005&quot;,&quot;stream_name&quot;:&quot;Ipad&quot;}" data-guid="widget-1508" data-initialized="true"><!--start template: templates/mention/signals/signal_action_bar.hjs -->
                                        <div class="signal-review-bar"><p><font><font>Reach Out</font></font></p></div>
                                        <ul class="mention-action-bar">
                                            <!-- <li class="mention-action-button">
                                                <button class="btn btn-danger reply" data-action="reply" data-mixpanel="signal_action">
                                                    <i class="icon-action-reply"></i><div><font><font>Reach Out</font></font></div>
                                                </button>
                                            </li> -->
                                            <li class="mention-action-button mention-actions mention-tag">
                                                <div class="btn-group">
                                                    <button data-toggle="dropdown" class="btn btn-danger"><i class="icon-action-tag"></i><div><font><font>Tag</font></font></div><i class="icon-action-dropdown"></i></button>
                                                    <div class="mozaic-widget tag_mention widget-tag_annotable" data-widget="tag_annotable" data-params="{&quot;object_class&quot;:&quot;signal_influencer&quot;,&quot;channels&quot;:{&quot;/tags&quot;:&quot;/tags-3&quot;,&quot;/taggings&quot;:&quot;/taggings-1501&quot;,&quot;/annotables&quot;:&quot;/signals-1414&quot;},&quot;id&quot;:&quot;27852612&quot;}" data-guid="widget-1802" data-initialized="true"><!--start template: templates/tag_annotable.hjs -->
                                                        <span class="square-hack"></span>
                                                        <div class="dropdown-menu">
                                                            <ul class="overview" messageid="<?php echo $item->message->getId() ?>" streamId="<?php echo $masterView->streamView->model->streamId; ?>">
                                                                <?php
                                                                $tags = Tag::getList();
                                                                foreach ($tags as $tag) {
                                                                    echo "<li data-id=\"$tag->tagId\">
                                                                            <a><i class=\"icon-circle-list\"></i><font><font>$tag->tagName</font></font></a>
                                                                        </li>";
                                                                }
                                                                ?><li><a><i class="icon-plus"></i><font><font>Add new tag</font></font></a></li>
                                                            </ul>
                                                        </div>
                                                        <!-- end template: templates/tag_annotable.hjs --></div></div>       
                                            </li>
                                            <li class="mention-action-button">
                                                <button class="btn btn-danger add-task" messageId="<?php echo $item->message->getId(); ?>" streamId="<?php echo $masterView->streamView->model->streamId; ?>"><i class="icon-action-addtask"></i><em></em><div><em><font><font>Add&nbsp;</font></font></em><font><font>task</font></font></div></button></li>             
                                            <li class="mention-action-button expand-action-item"><button class="btn btn-danger expand-signal"><i class="icon-action-expand extend"></i><div class="preview" url="<?php echo $item->message->getURL(); ?>"><font><font>Preview</font></font></div></button></li>    
                                            <li class="mention-action-button">
                                                <div class="btn-group settings-stream-menu">
                                                    <button data-toggle="dropdown" class="btn dropdown-toggle">
                                                        <i class="icon-settings"></i><i class="icon-action-dropdown"></i>
                                                    </button>
                                                    <span class="square-hack"></span>
                                                    <div class="dropdown-menu pull-right">        
                                                        <ul class="signal-preferences-dropdown">
                                                            <li class="mention-action-button customize-signals-button" data-id="27852612">
                                                                <a class="action-color-hover">
                                                                    <i class="icon-settings"></i><font><font>Customize Signals for this Stream
                                                                    </font></font></a>
                                                            </li>
                                                            <li class="mention-action-button disable-signals-button" data-id="27852612">
                                                                <a class="action-color-hover">
                                                                    <i class="icon-minus-sign"></i><font><font>Disable Signals for this Stream
                                                                    </font></font></a>
                                                            </li>

                                                            <li class="mention-action-button mark-irrelevant-button insert-delete-form" data-id="27852612">
                                                                <a class="action-color-hover">
                                                                    <i class="icon-action-irrelevant"></i><font><font>Mark Signal as Irrelevant
                                                                    </font></font></a>
                                                            </li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </li>

                                            <li class="mention-action-button go-top-button"><button class="btn btn-danger"><i class="icon-go-top"></i></button></li>
                                            <div class="tags-holder-container">
                                                <?php foreach($item->findTag() as $tag) {
                                                    echo '<div class="tag-holder-container"><label>'.$tag->tagName.'</label></div>';
                                                } ?>
                                            </div>
                                        </ul>

                                        <!-- end template: templates/mention/signals/signal_action_bar.hjs --></div></div>
                            </div>
                        </div>
                    </div>

                    <div class="annotables-replies-content">
                        <div class="annotations-holder-container">
                            <div class="mozaic-widget mozaic-initialized widget-annotable_tasks_and_posts empty">
                                <div class="tasks-and-posts">
                                    <div class="annotable-tasks-and-posts"></div>
                                    <div class="clear"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="clear"></div>
            </div>
        </div>
    </li>
<?php endforeach; ?>